// 海报图
export function drawPoster(data) {
  return new Promise(function(resolve) {
    switch (data.type) {
      case 'pro':
        resolve(poster(data))
        break
      default:
        resolve(poster(data))
    }
  })
}
// demo 微信分享图
function poster(data) {
  return {
    width: '550px',
    height: '876px',
    //background: '#f4f5f7',
    background: require("@/assets/images/promote_bak.jpg"),
    views: [
      {
        type: 'image',
        url: data.avatar,
        css: {
          top: '770px',
          left: '36px',
          borderRadius: '100%',
          width: '100px',
          height: '100px',
          borderWidth: '6px',
          borderColor: '#fff'
        }
      },
      {
        type: 'text',
        text: data.nickname,
        css: {
          bottom: '60px',
          left: '160px',
          width: '360px',
          maxLines: 1,
          fontSize: '20px',
          fontWeight: '500'
        }
      },
      {
        type: 'text',
        text: '邀请您加入',
        css: {
          bottom: '30px',
          left: '160px',
          width: '360px',
          maxLines: 1,
          fontSize: '20px',
          fontWeight: '500'
        }
      },
      {
        type: 'qrcode',
        content: window.location.host + "?pid=" + data.userId,
        css: {
          bottom: '5px',
          right: '26px',
          color: '#000',
          width: '110px',
          height: '110px'
        }
      }
    ]
  }
}
